home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts44-07
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c
- Subject: Re: Please help!
- Date: Fri, 02 Feb 96 18:33:00 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4etl2u$7s1@sam.inforamp.net>
- References: <4ehtt2$313@fang.dsto.defence.gov.au>
- NNTP-Posting-Host: ts44-07.tor.inforamp.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4ehtt2$313@fang.dsto.defence.gov.au>,
- yenh@MRD.SRL.dsto.gov.au (Hung Yen) wrote:
- >Please take a look at this source code:
- >
- >#include <Xm/List.h>
- >#include <stdio.h>
- >/* Function to sort an array of integers into ascending order */
- >void sort (a,n)
- >int a[];
- >int n;
- >{
- > int i,j,temp;
- > for (i=0; i < n -1; ++i)
- > for (j=i+1; j<n; ++j)
- > if (a[i] > a[j])
- > {
- > temp = a[i];
- > a[i] = a[j];
- > a[j] = temp;
- > }
- >
- >}
- >
- >int get_first_selected_plans(w,selected_count)
- >Widget w;
- >int selected_count;
- >{
- > int **position_list;
- > int *position_count, first_selected_plan_number;
- > Boolean Ok;
- >
- > if (!w){
- > return 0;
- > }
- > Ok = XmListGetSelectedPos(w,position_list,position_count);
- > sort(position_list,&position_count);
- > first_selected_plan_number = position_list[1];
- Right here.
- position_list[1] is a pointer to an integer
- and first_selected_plan_number is an integer.
- I could be wrong, but that's my read.
- > return first_selected_plan_number;
- >}
- >
- >This is my first try at C programming, so any help will be greatly
- appreciate.
- >
- >hung
- >
- >
-